/**
*@Author: QWP
*@Description: 树形相关操作
*@Date 2024-08-27 15:49
*/

// 只允许操作子级
export const useDisTreeParent = (data: any[], params: { key: string, value: boolean }) => {
  const { key, value } = params;
  const format = (tdata) =>{
    tdata.forEach(item => {
      if((item['children'] ||  []).length > 0) {
        item[key] = value
      }
    })
  }
  if((data || []).length != 0) {
    format(data)
  }
  return data
}